home *** CD-ROM | disk | FTP | other *** search
- Path: newsbf02.news.aol.com!not-for-mail
- From: recursion@aol.com (Recursion)
- Newsgroups: comp.lang.c++
- Subject: Re: for loop question
- Date: 4 Feb 1996 01:49:49 -0500
- Organization: America Online, Inc. (1-800-827-6364)
- Sender: root@newsbf02.news.aol.com
- Message-ID: <4f1kud$9rk@newsbf02.news.aol.com>
- References: <4emqf8$470@opal.southwind.net>
- Reply-To: recursion@aol.com (Recursion)
- NNTP-Posting-Host: newsbf02.mail.aol.com
-
- The loop is never entered when you set the value equal to 0. You have
- specifed the loop check value to be performed while equal to 10 by using
- the ==. The program works when the value is less than 10. If you were to
- set use
-
- int i;
- for (i=10;i==10;i++) the program would enter the loop only one time and
- would print out your data.
-
- int i;
- for(i=0;i--10;i++) will never execute because i will never equal 10.
-